package org.graphics;

import org.rsbot.script.util.Timer;

import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: Tim
 * Date: 9/8/11
 * Time: 5:05 PM
 * To change this template use File | Settings | File Templates.
 */
public class MasterRender {

    public MasterRender(int x, int y) {
        xloc = x;
        yloc = y;
        start = System.currentTimeMillis();
    }

    long start;
    int xloc = 0;
    int yloc = 0;
    Rectangle moveBox;

    int dot = 0;
    int i = 0;
    String dots = "";


    String getDot(int d) {
        String tot = "";
        if (dot > 3) {
            dot = 0;
            dots = "";
        }
        for (int j = 0; j < d; j++)
            tot += ".";
        dots = tot;
        return dots;
    }

    public void drawPaint(Graphics g) {
        i++;
        moveBox = new Rectangle(xloc, yloc, 30, 30);
        g.setColor(new Color(30, 30, 30, 195));
        g.fill3DRect(xloc, yloc, 200, 100, true);
        g.setColor(new Color(150, 20, 10, 115));
        g.fillRect(moveBox.x, moveBox.y, moveBox.width, moveBox.height);
        g.setColor(Color.white);
        g.drawString(
                "Time Running: "
                        + Timer.format(System.currentTimeMillis() - start),
                xloc + 10, yloc + 10);
        g.drawString("Status: " + getDot(dot), xloc + 10, yloc + 25);

        if (i % 20 == 0) {
            dot++;
        }
    }

}
